import {
  cmdInvoker,
  MenuItemDefinition,
  ObjectTreeMenuProps,
  Types,
} from '@amcax/base';
import { cmdSketchChangePlane } from '@app-cad/environments/nextcad/commands/feature/cmd-sketch-change-plane';

export const MenuItemChangeSketchPlane: MenuItemDefinition<ObjectTreeMenuProps> =
  {
    id: 'change-sketch-plane',
    children: '变更支持面',
    hidden: ({
      props: {
        documentObject: { type },
      },
    }) => type !== Types.Sketcher,

    onClick: ({ props: { documentObject } }) => {
      cmdInvoker.invokeCmd(cmdSketchChangePlane, {
        ...documentObject,
        children: [],
      });
    },
  };
